<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/11/7
  Time: 19:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div>
  <div style="color:red">${errorMsg}</div>
  <form action="add2" method="post" enctype="multipart/form-data">
    <div>
      供货商编号:<input type="text" name="supCode" id="Code"><span style="color: red">${supCodeError}</span>
    </div>
    <div>
      供货商名称:<input type="text" name="supName" id="supName"><span style="color: red">${supNameError}</span>
    </div>
    <div>
      供货商描述:<input type="text" name="supDesc"><span style="color: red">${supDescError}</span>
    </div>
    <div>
      供货商联系人:<input type="text" name="supContact">
    </div>
    <div>
      联系电话:<input type="text" name="supPhone" id="Phone">
    </div>
    <div>
      供货商地址:<input type="text" name="supAddress">
    </div>
    <div>
      <input type="file" name="idPic"><span style="color: red">${idPicError}</span>
    </div>
    <div>
      <input type="submit">
    </div>
  </form>
</div>
</body>
<script src="${pageContext.request.contextPath}/statics/layui/layui/layui.js" charset="utf-8"></script>
<script>
  layui.use(['jquery'],function (){
    var $ = layui.$;
    $('#Code').blur(function (){
      $.get('CodeSelect?supCode='+this.value,function (data){
        if(data=="0"){
          $('#Code').next().html('该供货商编号已存在')
        }else{
          $('#Code').next().html('')
        }
      });
    });
    $('#supName').blur(function (){
      $.get('supNameSelect?supName='+this.value,function (data){
        if(data=="0"){
          $('#supName').next().html('该供货商名称已存在')
        }else{
          $('#supName').next().html('')
        }
      })
    })
  })

</script>
</html>
